package net.lzzy.algorithm.find;

public class DirectSearch<T extends Comparable<? super T>>extends BaseSearch<T> {
    DirectSearch(T[] itmes) {
        super(itmes);
    }
    @Override
    public int search(T key) {
        long start=System.currentTimeMillis();
        int pos=0;
       for (T itme:itmes){
           if (equal(itme,key)){
             setTime( System.currentTimeMillis()-start);
               return pos;
           }
           pos++;
       }
        setTime( System.currentTimeMillis()-start);
        return -1;
    }
}
